# Methods added to this helper will be available to all templates in the application.
require 'string'
module ApplicationHelper
  # => 判断是不是管理员
  def is_admin?
    current_user && @current_user.try(:role) == 'boss'
  end

  # =>判断是否要递推加载所有JS，只有管理台才需要递推加载
  def recursive_include?
    params[:controller] == 'admin' or (params[:controller] == 'posts' and params[:action] == 'show')
  end

  # => 是否显示浏览类类型

  def show_list_type?
    "#{params[:controller]}/#{params[:action]}" =~ /posts\/list|site\/index/
  end
end
